<?php

/**
 * This is the model class for table "nilaiproduksiikan".
 *
 * The followings are the available columns in table 'nilaiproduksiikan':
 * @property integer $npi_id
 * @property integer $npi_kec
 * @property double $npi_mas_prod
 * @property double $npi_mas_nilai
 * @property double $npi_tawes_prod
 * @property double $npi_tawes_nilai
 * @property double $npi_mujair_prod
 * @property double $npi_mujair_nilai
 * @property double $npi_tambakan_prod
 * @property double $npi_tambakan_nilai
 * @property double $npi_nilem_prod
 * @property double $npi_nilem_nilai
 * @property double $npi_gurame_prod
 * @property double $npi_gurame_nilai
 * @property double $npi_nila_prod
 * @property double $npi_nila_nilai
 * @property double $npi_lain_prod
 * @property double $npi_lain_nilai
 * @property integer $npi_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $npiKec
 */
class Nilaiproduksiikan extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Nilaiproduksiikan the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'nilaiproduksiikan';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('npi_kec, npi_tahun', 'numerical', 'integerOnly'=>true),
			array('npi_mas_prod, npi_mas_nilai, npi_tawes_prod, npi_tawes_nilai, npi_mujair_prod, npi_mujair_nilai, npi_tambakan_prod, npi_tambakan_nilai, npi_nilem_prod, npi_nilem_nilai, npi_gurame_prod, npi_gurame_nilai, npi_nila_prod, npi_nila_nilai, npi_lain_prod, npi_lain_nilai', 'numerical'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('npi_id, npi_kec, npi_mas_prod, npi_mas_nilai, npi_tawes_prod, npi_tawes_nilai, npi_mujair_prod, npi_mujair_nilai, npi_tambakan_prod, npi_tambakan_nilai, npi_nilem_prod, npi_nilem_nilai, npi_gurame_prod, npi_gurame_nilai, npi_nila_prod, npi_nila_nilai, npi_lain_prod, npi_lain_nilai, npi_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'npiKec' => array(self::BELONGS_TO, 'Kecamatan', 'npi_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'npi_id' => 'Npi',
			'npi_kec' => 'Npi Kec',
			'npi_mas_prod' => 'Npi Mas Prod',
			'npi_mas_nilai' => 'Npi Mas Nilai',
			'npi_tawes_prod' => 'Npi Tawes Prod',
			'npi_tawes_nilai' => 'Npi Tawes Nilai',
			'npi_mujair_prod' => 'Npi Mujair Prod',
			'npi_mujair_nilai' => 'Npi Mujair Nilai',
			'npi_tambakan_prod' => 'Npi Tambakan Prod',
			'npi_tambakan_nilai' => 'Npi Tambakan Nilai',
			'npi_nilem_prod' => 'Npi Nilem Prod',
			'npi_nilem_nilai' => 'Npi Nilem Nilai',
			'npi_gurame_prod' => 'Npi Gurame Prod',
			'npi_gurame_nilai' => 'Npi Gurame Nilai',
			'npi_nila_prod' => 'Npi Nila Prod',
			'npi_nila_nilai' => 'Npi Nila Nilai',
			'npi_lain_prod' => 'Npi Lain Prod',
			'npi_lain_nilai' => 'Npi Lain Nilai',
			'npi_tahun' => 'Npi Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('npi_id',$this->npi_id);
		$criteria->compare('npi_kec',$this->npi_kec);
		$criteria->compare('npi_mas_prod',$this->npi_mas_prod);
		$criteria->compare('npi_mas_nilai',$this->npi_mas_nilai);
		$criteria->compare('npi_tawes_prod',$this->npi_tawes_prod);
		$criteria->compare('npi_tawes_nilai',$this->npi_tawes_nilai);
		$criteria->compare('npi_mujair_prod',$this->npi_mujair_prod);
		$criteria->compare('npi_mujair_nilai',$this->npi_mujair_nilai);
		$criteria->compare('npi_tambakan_prod',$this->npi_tambakan_prod);
		$criteria->compare('npi_tambakan_nilai',$this->npi_tambakan_nilai);
		$criteria->compare('npi_nilem_prod',$this->npi_nilem_prod);
		$criteria->compare('npi_nilem_nilai',$this->npi_nilem_nilai);
		$criteria->compare('npi_gurame_prod',$this->npi_gurame_prod);
		$criteria->compare('npi_gurame_nilai',$this->npi_gurame_nilai);
		$criteria->compare('npi_nila_prod',$this->npi_nila_prod);
		$criteria->compare('npi_nila_nilai',$this->npi_nila_nilai);
		$criteria->compare('npi_lain_prod',$this->npi_lain_prod);
		$criteria->compare('npi_lain_nilai',$this->npi_lain_nilai);
		$criteria->compare('npi_tahun',$this->npi_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}